<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  author: Jsonor
  date: 2018/5/10 15:44
  description: Description
--%>
<%@ page contentType="text/html;charset=UTF-8" isELIgnored="false" %>
<html>
<head>
  <title>Title</title>
  <link href="${pageContext.request.contextPath}/css/common.css" rel="stylesheet" type="text/css"/>
  <link href="${pageContext.request.contextPath}/css/cart.css" rel="stylesheet" type="text/css"/>
<%--<style>
    .total .button {
      text-align:right;
    }
  </style>--%>
</head>
<body>
<%--如果购物项这个单例集合中有值，就说明购物车中有信息，显示购物车信息 --%>
<c:choose>
  <c:when test="${cartList ne null}">
    <div class="container cart">
      <div class="span24">
        <div class="step step1">
          <span style="line-height:60px; font-size:15px; font-weight:bold;"><a href="${pageContext.request.contextPath}/index.jsp">首页</a>>></span>
          <span style="line-height:60px; font-size:15px; font-weight:bold;">购物车信息</span>
        </div>
        <table>
          <tbody>
          <tr>
            <th>图片</th>
            <th>汽车名称</th>
            <th>汽车价格</th>
            <th>数量</th>
            <th>小计</th>
            <th>操作</th>
          </tr>
          <c:forEach var="c" items="${cartList}">
            <tr>
              <td width="60">
                <input type="hidden" name="id" value="22"/>
                <a href="${pageContext.request.contextPath}/shopcar.do?carid=${c.car.carid}">
                  <img src="${pageContext.request.contextPath}/${c.car.carimages}"/>
                </a>
              </td>
              <td>
                <a target="_blank">${c.car.carname}</a>
              </td>
              <td>
                ￥${c.car.caroriginalprice}万
              </td>
              <td class="quantity" width="60">
                  ${c.num}
              </td>
              <td width="140">
                <span class="subtotal">￥${c.num*c.car.caroriginalprice}万</span>
              </td>
              <td>
                <a href="${pageContext.request.contextPath}/deletecart.do?cartid=${c.cartid}" class="delete">删除</a>
              </td>
            </tr>
          </c:forEach>
          </tbody></table>
        <dl id="giftItems" class="hidden" style="display: none;">
        </dl>
        <div class="total">
          总金额: <strong id="effectivePrice">￥${total}万元</strong>
          <a href="${pageContext.request.contextPath}/createOrder.do"><h3>全部购买</h3></a>
          <%--<a href="#" class="button"></a>--%>
        </div>


        <div class="bottom">
          <a href="${pageContext.request.contextPath}/cleancart.do" id="clear" class="clear">清空购物车</a>
        </div>

      </div>
    </div>
  </c:when>
  <c:otherwise>
    <div style="text-align: center;">
      <span style="font-size: 20px;">
	                  亲，购物车中空空如也，赶紧去商城购物吧
	                  去看看？<a href="${pageContext.request.contextPath}/index.jsp">点击跳转</a>
	   </span>
    </div>
  </c:otherwise>
</c:choose>
<%@include file="bottom.jsp"%>
</body>
</html>
